package com.lv.hechuang.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.lv.hechuang.R;
import com.lv.hechuang.base.BaseFragment;

/**
 * @ClassName: MineFragment
 * @Description: 我的
 * @Author: lv
 * @Date: 2020/9/2 15:05
 */
public class MineFragment extends BaseFragment {

    private static final int CHANGE_RESULT = 671;
    private TextView tv_title;
    private ImageView iv_right;
    private ImageView iv_right_second;
    private TextView tv_mine_name;
    private TextView tv_mine_identity;
    private TextView tv_mine_address;
    private LinearLayout ll_mine_mail_all;
    private String identity;
    private TextView tv_mine_exit;
    private LinearLayout ll_choose_identity;
    private ImageView iv_connect_icon;
    private TextView tv_connect_title;
    private ImageView iv_setting_icon;
    private ImageView iv_choose_identity_icon;

    @Override
    public void initData(Bundle bundle) {

    }

    @Override
    public int bindLayout() {
        return R.layout.fragment_mine;
    }

    @Override
    public void initView(Bundle savedInstanceState, View view) {
        fvbi(R.id.ll_back).setVisibility(View.GONE);
        tv_title = fvbi(R.id.tv_title);
        iv_right = fvbi(R.id.iv_right);
        iv_right_second = fvbi(R.id.iv_right_second);
        tv_mine_name = fvbi(R.id.tv_mine_name);
        tv_mine_identity = fvbi(R.id.tv_mine_identity);
        tv_mine_address = fvbi(R.id.tv_mine_address);
        ll_mine_mail_all = fvbi(R.id.ll_mine_mail_all);
        ll_choose_identity = fvbi(R.id.ll_choose_identity);

        tv_mine_exit = fvbi(R.id.tv_mine_exit);
        iv_connect_icon = fvbi(R.id.iv_connect_icon);
        tv_connect_title = fvbi(R.id.tv_connect_title);
        iv_setting_icon = fvbi(R.id.iv_setting_icon);
        iv_choose_identity_icon = fvbi(R.id.iv_choose_identity_icon);
        ll_mine_mail_all.setOnClickListener(this);
        ll_choose_identity.setOnClickListener(this);

    }

    @Override
    public void doBusiness() {
        tv_title.setText(R.string.mine_center);
        iv_right_second.setVisibility(View.VISIBLE);
        iv_right_second.setImageResource(R.mipmap.mine_zxing_icon);

        tv_mine_exit.setOnClickListener(this);
    }

    @Override
    public void onWidgetClick(View view) {
        switch (view.getId()) {
            case R.id.tv_mine_exit:
                exitAccount();//退出账号
                break;
            case R.id.ll_choose_identity://切换身份
                break;
        }
    }

    //退出账号
    private void exitAccount() {

    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
        if (!hidden) {
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        if (requestCode == CHANGE_RESULT && resultCode == CHANGE_RESULT) {
            getActivity().finish();
        }
    }
}
